﻿@model ProductModel
@using Telerik.Web.Mvc.UI;
@{
    //page title
    ViewBag.Title = T("Admin.Catalog.Products.EditProductDetails").Text;
}
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "product-form" }))
{
    <div class="section-header">
        <div class="title">
            <img src="@Url.Content("~/Administration/Content/images/ico-catalog.png")" alt="" />
            @T("Admin.Catalog.Products.EditProductDetails") - @Model.Name @Html.ActionLink("(" + T("Admin.Catalog.Products.BackToList") + ")", "List")
        </div>
        <div class="options">
            <input type="submit" value="@T("Admin.Common.Preview")" onclick="javascript:OpenWindow('@Url.RouteUrl("Product", new { productId = Model.Id, SeName = "" })', 800, 600, true); return false;" class="t-button" />
            <button type="submit" name="save" value="save" class="t-button">@T("Admin.Common.Save")</button>
            <button type="submit" name="save" value="save-continue" class="t-button">@T("Admin.Common.SaveContinue")</button>
            <button type="submit" id="copyproduct" name="copyproduct" value="copyproduct" class="t-button">@T("Admin.Catalog.Products.Copy")</button>
            <span id="product-delete" class="t-button">@T("Admin.Common.Delete")</span>
        </div>
    </div>
    @Html.Partial("_CreateOrUpdate", Model)
}
@Html.DeleteConfirmation("product-delete")

@*copy product form*@
@{Html.Telerik().Window()
        .Name("copyproduct-window")
        .Title(T("Admin.Catalog.Products.Copy").Text)
        .Content(@<text>
    @using (Html.BeginForm("CopyProduct", "Product"))
    {
        @Html.HiddenFor(model => Model.CopyProductModel.Id)
        <table style="text-align: left;">
            <tr>
                <td>
                    @Html.NopLabelFor(model => model.CopyProductModel.Name):
                </td>
                <td>
                    @Html.EditorFor(model => Model.CopyProductModel.Name)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.NopLabelFor(model => model.CopyProductModel.Published):
                </td>
                <td>
                    @Html.EditorFor(model => Model.CopyProductModel.Published)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.NopLabelFor(model => model.CopyProductModel.CopyImages):
                </td>
                <td>
                    @Html.EditorFor(model => Model.CopyProductModel.CopyImages)
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <button type="submit" class="t-button t-state-default">@T("Admin.Catalog.Products.Copy")</button>
                </td>
            </tr>
        </table>
    }
    </text>)
        .Width(400)
        .Draggable(true)
        .Modal(true)
        .Visible(false)
        .Render();
}
<script type="text/javascript">
    $(document).ready(function () {

        $("#copyproduct").click(function (e) {
            e.preventDefault();
            $('#copyproduct-window').data('tWindow').center().open();
        });
    });
</script>
